package com.ylbh.modules.shortmessage.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ylbh.common.pojo.shortmessage.dto.ShortMessageDTO;
import com.ylbh.common.pojo.shortmessage.vo.ShortMessageVO;
import com.ylbh.common.pojo.shortmessage.vo.SmsSelectTemplateVO;
import com.ylbh.modules.shortmessage.entity.AppSmsTemplate;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

/**
 * 发送短信
 */

@Mapper
@Repository
public interface ShortMessageMapper extends BaseMapper<ShortMessageDTO> {

    /**
     * 全部用户
     * @param page
     * @return
     */
    List<ShortMessageVO> selectShortMessageUser(Page<Integer> page);

    /**
     * 根据用户类型
     * @param userType
     * @return
     */
    List<ShortMessageVO> selectUserType(Integer userType, Page page);

    /**
     * 根据的是注册时间或者活跃时间
     * @param startTime
     * @param endTime
     * @param page
     * @return
     */
    List<ShortMessageVO> selectUserAddTimeOrLastLoginDate(Integer conditionType, Date startTime, Date endTime, Page<Integer> page);

    /**
     * 指定用户
     * @param userName
     * @return
     */
    List<ShortMessageVO> selectUserByUserName(String userName);

    /**
     * 下单区间
     * @param startTime
     * @param endTime
     * @param page
     * @return
     */
    List<ShortMessageVO> selectOrderTime(Date startTime, Date endTime, Page<Integer> page);

    List<ShortMessageVO> selectSendByUserType(Integer userType);

    List<ShortMessageVO> selectSendOrderTime(Date startTime, Date endTime);

    List<ShortMessageVO> selectSendUserAddTimeOrLastLoginDate(Integer conditionType, Date startTime, Date endTime);

    List<ShortMessageVO> selectSendShortMessageUser();
    /**
     * 新增模板表
     * @param appSmsTemplate
     * @return
     */
    void insertAppSmsTemplate(AppSmsTemplate appSmsTemplate);
    /**
     * 阿里云短信模板查询
     * @return
     */
    List<AppSmsTemplate > selectTemplateCode();
}
